From 410718e68c91b8a9cd436f4a9542e6cc2027861b Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 31 Aug 2005 14:38:56 +0000 Subject: [PATCH] Add Format skeleton. From Olaf. --- gpsbabel/filter_skeleton.c | 2 +- gpsbabel/format_skeleton.c | 128 +++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 gpsbabel/format_skeleton.c diff --git a/gpsbabel/filter_skeleton.c b/gpsbabel/filter_skeleton.c index abff8df11..fe6e3b33c 100644 --- a/gpsbabel/filter_skeleton.c +++ b/gpsbabel/filter_skeleton.c @@ -2,7 +2,7 @@ Filter skeleton: - Simple copy this file to .c and + Simply copy this file to .c and rename all filter_skeleton tokens to . Replace the stupid name and address in the Copyright few lines below. To active your new filter you have to create a new section in diff --git a/gpsbabel/format_skeleton.c b/gpsbabel/format_skeleton.c new file mode 100644 index 000000000..ef891d4fd --- /dev/null +++ b/gpsbabel/format_skeleton.c @@ -0,0 +1,128 @@ +/* + + Format converter module skeleton. + + Steps to create a new format. + + 1) Copy this file to .c + 2) Rename all format_skeleton tokens to . + 3) Replace the fictional name and address in the Copyright section below. + As your work is likely built on the work of others, please retain + the original line. + 4) Create a new section in vecs.c. + 5) Add compilation instructions to Makefile. + 6) Add sample files (it's better when they're created by the "real" + application and not our own output) to reference/ along with + files in a well supported (preferably non-binary) format and + entries in our 'testo' program. This allows users of different + OSes and hardware to exercise your module. + + Copyright (C) YYYY John Doe, anybody@wherever.com + Copyright (C) 2005 Robert Lipe, robertlipe@usa.net + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA + + */ + +#include "defs.h" +#include + +#define MYNAME "format_skeleton" + + +// Any arg in this list will appear in command line help and will be +// populated for you. +// Values for ARGTYPE_xxx can be found in defs.h and are used to +// select the type of option. +static +arglist_t format_skeleton_args[] = { +// {"foo", &fooopt, "The text of the foo option in help", +// "default", ARGYTPE_STRING} , + {0, 0, 0, 0, 0} +}; + +/******************************************************************************* +* %%% global callbacks called by gpsbabel main process %%% * +*******************************************************************************/ + +static void +format_skeleton_rd_init(const char *fname) +{ +// fin = xfopen("r", fname); +} + +static void +format_skeleton_rd_deinit(void) +{ +// fclose(fin); +} + +static void +format_skeleton_read(void) +{ +// your special code to extract waypoint, route and track +// information from file "fin" +} + +static void +format_skeleton_rw_init(const char *fname) +{ +// fout = xfopen("w", fname); +} + +static void +format_skeleton_rw_deinit(void) +{ +// fclose(fout); +} + +static void +format_skeleton_write(void) +{ +// Here is how you register callbacks for all waypoints, routes, tracks. +// waypt_disp_all(waypt) +// route_disp_all(head, tail, rtept); +// track_disp_all(head, tail, trkpt); +} + +static void +format_skeleton_exit(void) /* optional */ +{ +} + +/**************************************************************************/ + +// capabilities below means: we can only read and write waypoints +// please change this depending on your new module + +ff_vecs_t format_skeleton_vecs = { + ff_type_file, + { + ff_cap_read | ff_cap_write /* waypoints */, + ff_cap_none /* tracks */, + ff_cap_none /* routes */ + }, + format_skeleton_rd_init, + format_skeleton_wr_init, + format_skeleton_rd_deinit, + format_skeleton_wr_deinit, + format_skeleton_read, + format_skeleton_write, + format_skeleton_exit, + format_skeleton_args, + CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ + /* not fixed, can be changed through command line parameter */ +}; +/**************************************************************************/ -- 2.30.2